home *** CD-ROM | disk | FTP | other *** search
- property spriteNum, row, location
- global tableau, stock, currentsel, points, vanish, topRow, midRow, botRow
-
- on beginSprite me
- location = sprite(spriteNum).loc
- row = determinerow()
- sprite(spriteNum).member = member(stock.cards[1].rank & "_" & stock.cards[1].suit, "playing cards")
- stock.cards.deleteAt(1)
- tableau.addProp(row, new(script("card pile")))
- tableau[row].addCard(spriteNum)
- sprite(spriteNum).visible = 1
- end
-
- on determinerow
- if spriteNum = 11 then
- return #one
- else
- if spriteNum = 13 then
- return #two
- else
- if spriteNum = 15 then
- return #three
- else
- if spriteNum = 17 then
- return #four
- else
- if spriteNum = 18 then
- return #five
- else
- if spriteNum = 20 then
- return #six
- else
- if spriteNum = 22 then
- return #seven
- else
- if spriteNum = 24 then
- return #eight
- else
- if spriteNum = 25 then
- return #nine
- else
- if spriteNum = 27 then
- return #ten
- else
- if spriteNum = 29 then
- return #eleven
- else
- if spriteNum = 31 then
- return #twelve
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end if
- end
-
- on mouseDown me
- if tableau[row].getcardcount() > 0 then
- if currentsel.count() < 2 then
- if not currentsel.findPos(spriteNum) then
- puppetSound(3, member("pick card", "100GPak Generic SFX"))
- currentsel.add(spriteNum)
- sprite(spriteNum).member = member(sprite(spriteNum).member.name & "_black", "playing cards")
- end if
- if currentsel.count() = 2 then
- currentsel.sort()
- checkCardValues()
- end if
- end if
- end if
- end
-
- on checkCardValues me
- if (sprite(currentsel[2]).loc - sprite(currentsel[1]).loc) = point(120, 0) then
- if tableau[sprite(currentsel[1]).row].getlastcard().rank = tableau[sprite(currentsel[2]).row].getlastcard().rank then
- if getRow(currentsel[2]).count() > 3 then
- vanish = timeout("vanish").new(200, #vanishit, sprite(currentsel[2]))
- else
- vanish = timeout("vanish").new(200, #vaniall, sprite(currentsel[2]))
- end if
- points = points + 40
- checkwin()
- else
- puppetSound(3, member("drop card", "100GPak Generic SFX"))
- vanish = timeout("vanish2").new(200, #nogo)
- end if
- else
- puppetSound(3, member("drop card", "100GPak Generic SFX"))
- vanish = timeout("vanish3").new(200, #nogo)
- end if
- end
-
- on vanishit me
- vanish.forget()
- puppetSound(3, member("pick card", "100GPak Generic SFX"))
- sprite(currentsel[1]).member = member(chars(sprite(currentsel[1]).member.name, 1, sprite(currentsel[1]).member.name.length - 6), "playing cards")
- sprite(spriteNum).member = member("empty", "playing cards")
- sprite(spriteNum).visible = 0
- sprite(spriteNum - 1).member = member("empty", "playing cards")
- sprite(spriteNum - 1).visible = 0
- repeat with i = 1 to tableau[sprite(currentsel[2]).row].cards.count
- sprite(32).member = member(tableau[sprite(currentsel[2]).row].cards[1].membername, "playing cards")
- updateStage()
- end repeat
- currentsel.sort()
- if getRow(currentsel[2]).findPos(currentsel[2]) > 2 then
- repeat with i = getRow(currentsel[2]).count() down to getRow(currentsel[2]).findPos(currentsel[2])
- sprite(getRow(currentsel[2])[i]).loc = sprite(getRow(currentsel[2])[i - 2]).location
- updateStage()
- end repeat
- end if
- getRow(currentsel[2]).deleteOne(currentsel[2])
- getRow(currentsel[2]).deleteOne(currentsel[2] - 1)
- tableau.deleteProp(sprite(currentsel[2]).row)
- currentsel.deleteAll()
- checkwin()
- end
-
- on vaniall me
- vanish.forget()
- puppetSound(3, member("pick card", "100GPak Generic SFX"))
- sprite(currentsel[1]).member = member("empty", "playing cards")
- sprite(spriteNum).member = member("empty", "playing cards")
- sprite(spriteNum - 1).member = member("empty", "playing cards")
- repeat with i = 1 to tableau[sprite(currentsel[2]).row].cards.count
- sprite(32).member = member(tableau[sprite(currentsel[2]).row].cards[1].membername, "playing cards")
- updateStage()
- end repeat
- repeat with i = 1 to tableau[sprite(currentsel[1]).row].cards.count
- sprite(32).member = member(tableau[sprite(currentsel[1]).row].cards[1].membername, "playing cards")
- updateStage()
- end repeat
- getRow(currentsel[2]).deleteOne(currentsel[2])
- getRow(currentsel[2]).deleteOne(currentsel[2] - 1)
- tableau[sprite(currentsel[1]).row].cards.deleteAll()
- tableau[sprite(currentsel[2]).row].cards.deleteAll()
- currentsel.deleteAll()
- points = points + 10
- checkwin()
- end
-